package com.detu.ivos.audit.controller;

import com.detu.ivos.audit.pojo.dto.AuditQuery;
import com.detu.ivos.audit.pojo.dto.AuditSaveParam;
import com.detu.ivos.audit.pojo.vo.AuditVO;
import com.detu.ivos.audit.service.AuditService;
import com.detu.ivos.base.response.JsonResult;
import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/v1/audit")
@Slf4j
public class AuditController {
    @Autowired
    AuditService auditService;

   @GetMapping("select")
    public JsonResult select(AuditQuery auditQuery){
       List<AuditVO> auditVOList=auditService.select(auditQuery);
       log.debug("查到的审批列表{}",auditVOList);
       return JsonResult.ok(auditVOList);
   }

   @PostMapping("update")
   public JsonResult select(AuditSaveParam auditSaveParam){
       auditService.updateAuditStatus(auditSaveParam);
       return JsonResult.ok();
   }
}
